From: Giovanni Campagna Date: Tue, 17 Mar 2015 20:08:05 +0000 (-0700) Subject: Telepathy: hide chat notifications when focusing the app X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~1412 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d8926b96e28fb23ace76d207f765cb2ad48b7096;p=gnome-shell.git Telepathy: hide chat notifications when focusing the app When the chat app is focused, we should hide all banners immediately. A good way to do so, without tracking which app is focused, is to look for messages that are acked when the banner is unexpanded, which implies they were acked by some other telepathy client. https://bugzilla.gnome.org/show_bug.cgi?id=746364 --- diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index ba2f3b486..38b534782 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -577,6 +577,10 @@ const ChatSource = new Lang.Class({ this._pendingMessages.splice(idx, 1); this.countUpdated(); } + + if (this._pendingMessages.length == 0 && + this._banner && !this._banner.expanded) + this._banner.hide(); }, _ackMessages: function() { @@ -830,6 +834,10 @@ const ChatNotificationBanner = new Lang.Class({ adjustment.value = adjustment.upper; }, + hide: function() { + this.emit('done-displaying'); + }, + _addMessage: function(message) { let highlighter = new Calendar.URLHighlighter(message.body, true, true); let body = highlighter.actor;